<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>pvsfilter</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="pvsdisp.html" title="pvsdisp" />
    <link rel="next" href="pvsfread.html" title="pvsfread" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">pvsfilter</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pvsdisp.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="pvsfread.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="pvsfilter"></a>
      <div class="titlepage"></div>
      <a id="IndexPvsfilter" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">pvsfilter</span>
        </h2>
        <p>pvsfilter — 
      Multiply amplitudes of a pvoc stream by those of a second
pvoc stream, with dynamic scaling.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138584160"></a>
        <h2>Description</h2>
        <p>
      Multiply amplitudes of a pvoc stream by those of a second
pvoc stream, with dynamic scaling.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138585440"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">fsig <span class="command"><strong>pvsfilter</strong></span> fsigin, fsigfil, kdepth[, igain]</pre>
      </div>
      <div class="refsect1">
        <a id="idp138587456"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>fsig</em></span> -- output pv stream
    </p>
        <p>
      <span class="emphasis"><em>fsigin</em></span> -- input pv stream.
    </p>
        <p>
      <span class="emphasis"><em>fsigfil</em></span> -- filtering pvoc stream.
    </p>
        <p>
      <span class="emphasis"><em>kdepth</em></span> -- controls the depth of filtering
    of fsigin by fsigfil .
    </p>
        <p>
      <span class="emphasis"><em>igain</em></span> -- amplitude scaling (optional, defaults to 1).
    </p>
        <p>
    Here the input pvoc stream amplitudes are modified by the
    filtering stream, keeping its frequencies intact. As usual, both
    signals have to be in the same format.
  </p>
        <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
      It is unsafe to use the same f-variable for both input and output of pvs opcodes. Using the same one might lead to undefined behavior on some opcodes. Use a different one on the left and right sides of the opcode.
    </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp138594048"></a>
        <h2>Examples</h2>
        <p>
      </p>
        <div class="example">
          <a id="idp138594976"></a>
          <p class="title">
            <strong>Example 687. Example</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
kfreq  <span class="opc">expon</span> 500, p3, 4000           <span class="comment">; 3-octave sweep</span>
kdepth <span class="opc">linseg</span> 1, p3/2, 0.5, p3/2, 1  <span class="comment">; varying filter depth</span>

asig  <span class="opc">in</span>                             <span class="comment">; input</span>
afil  <span class="opc">oscili</span>  1, kfreq, 1            <span class="comment">; filter t-domain signal</span>

fim   <span class="opc">pvsanal</span>  asig,1024,256,1024,0  <span class="comment">; pvoc analysis</span>
fil   <span class="opc">pvsanal</span>  afil,1024,256,1024,0  
fou   <span class="opc">pvsfilter</span> fim, fil, kdepth     <span class="comment">; filter signal</span>
aout  <span class="opc">pvsynth</span>  fou                   <span class="comment">; pvoc synthesis</span>
        </pre>
          </div>
        </div>
        <p><br class="example-break" />

    </p>
        <p>
     In the example above the filter curve will depend on the
spectral envelope of afil; in the simple case of a sinusoid,
it will be equivalent to a narrowband band-pass filter.</p>
        <p>
      Here is an example of the use of the <span class="emphasis"><em>pvsfilter</em></span> opcode. It uses the file <a class="ulink" href="examples/pvsfilter.csd" target="_top"><em class="citetitle">pvsfilter.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp138609408"></a>
          <p class="title">
            <strong>Example 688. Example of the <span class="emphasis"><em>pvsfilter</em></span> opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
-odac
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 16
<span class="ohdr">nchnls</span> <span class="op">=</span> 1
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

<span class="comment">;; example written by joachim heintz 2009</span>

giSine		<span class="ohdr">ftgen</span>		0, 0, 4096, 10, 1
giBell		<span class="ohdr">ftgen</span>		0, 0, 4096, 9, .56, 1, 0, .57, .67, 0, .92, 1.8, 0, .93, 1.8, 0, 1.19, 2.67, 0, 1.7, 1.67, 0, 2, 1.46, 0, 2.74, 1.33, 0, 3, 1.33, 0, 3.76, 1, 0, 4.07, 1.33, 0<span class="comment">; bell-like (after Risset)</span>

<span class="oblock">instr</span> 1
ipermut	<span class="op">=</span>		p4<span class="comment">; 1 = change order of soundfiles </span>
ifftsize	<span class="op">=</span>		1024
ioverlap	<span class="op">=</span>		ifftsize <span class="op">/</span> 4
iwinsize	<span class="op">=</span>		ifftsize
iwinshape	<span class="op">=</span>		1<span class="comment">; von-Hann window</span>
Sfile1		<span class="op">=</span>		"fox.wav"
ain1		<span class="opc">soundin</span>	Sfile1
kfreq		<span class="opc">randomi</span>	200, 300, 3
ain2		<span class="opc">oscili</span>		.2, kfreq, giBell
<span class="comment">;ain2		oscili		.2, kfreq, giSine; try also this </span>
fftin1		<span class="opc">pvsanal</span>	ain1, ifftsize, ioverlap, iwinsize, iwinshape<span class="comment">; fft-analysis of file 1</span>
fftin2		<span class="opc">pvsanal</span>	ain2, ifftsize, ioverlap, iwinsize, iwinshape<span class="comment">; fft-analysis of file 2</span>
<span class="octrl">if</span> ipermut <span class="op">==</span> 1 then
fcross		<span class="opc">pvsfilter</span>	fftin2, fftin1, 1
<span class="octrl">else</span>
fcross		<span class="opc">pvsfilter</span>	fftin1, fftin2, 1
<span class="octrl">endif</span>
aout		<span class="opc">pvsynth</span>	fcross
		<span class="opc">out</span>		aout <span class="op">*</span> 20
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">i</span> 1 0 2.757 0<span class="comment">; frequencies from fox.wav, amplitudes multiplied by amplitudes of giBell</span>
<span class="stamnt">i</span> 1 3 2.757 1<span class="comment">; frequencies from giBell, amplitudes multiplied by amplitudes of fox.wav</span>
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138614128"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="pvsanal.html" title="pvsanal"><em class="citetitle">pvsanal</em></a>,
      <a class="link" href="pvsynth.html" title="pvsynth"><em class="citetitle">pvsynth</em></a>,
      <a class="link" href="pvsadsyn.html" title="pvsadsyn"><em class="citetitle">pvsadsyn</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp138618096"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Victor Lazzarini</td>
          </tr>
          <tr>
            <td>November 2004 </td>
          </tr>
        </table>
        <p>
    </p>
        <p>New plugin in version 5</p>
        <p>November 2004.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pvsdisp.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="pvsfread.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pvsdisp </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> pvsfread</td>
        </tr>
      </table>
    </div>
  </body>
</html>
